package com.jusda.api.task;

import com.jusda.entity.Order;
import com.jusda.mapper.OrderJpaResp;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

/**
 * @author:y022 07/05/2022 10:04
 * @description:
 */
@Slf4j
@AllArgsConstructor
@NoArgsConstructor
public class  DataGenerateTask implements Runnable {
    private OrderJpaResp orderJpaResp;
    private List<Order> listTask = new ArrayList<>();

    @Override
    public void run() {
        long start = System.currentTimeMillis();
        log.debug("线程" + Thread.currentThread().getName() + "开始任务！！");
        orderJpaResp.saveAll(listTask);
        long end = System.currentTimeMillis() - start;
        log.debug("线程" + Thread.currentThread().getName() + "执行任务耗时！！" + end + "ms");
    }
}
